

#include <sgi_ut/SGI_utE.h>





	// ******************* CONSTRUCTOR ************************************



SGI_ut::SGI_ut(const char * const roomname,TEDROOMComponentID id, unsigned int roomNumMaxMens, TEDROOMPriority roomtaskPrio, TEDROOMStackSizeType roomStack, CEDROOMMemory *pActorMemory ) : 
		CEDROOMComponent(roomname,id,EDROOMprioMINIMUM+1,4,roomNumMaxMens,roomtaskPrio,roomStack, pActorMemory )




		// ***************	Estado Top *****************

		,edroomTopState(*this)


{


}


	//***************	METODOS PUBLICOS  ********************************



		//**********           CONFIGURACION               ************


int SGI_ut::EDROOMConfig() {




 return 0; }



		//**********           START               ************


int SGI_ut::EDROOMStart() {



		//****************** INICIO DEL PROPIO ACTOR **********************

	CEDROOMComponent::EDROOMStart(); 	// Llamada a la funcion Start de la clase Actor

return 0;}


	// ***************	METODOS PROTEGIDOS *******************************



		//**********        COMPORTAMIENTO           ************



void SGI_ut::EDROOMBehaviour() {

	edroomTopState.EDROOMBehaviour();

}




		//**********        ACTORTERMINADO           ************


	#ifdef _EDROOM_SYSTEM_CLOSE

TEDROOMBool SGI_ut::EDROOMIsComponentFinished() {


	return ( EmuPlanner.EDROOMIsComponentFinished() && EmuGS.EDROOMIsComponentFinished() && TMTCServer.EDROOMIsComponentFinished() && Sgi.EDROOMIsComponentFinished() && CEDROOMComponent::EDROOMIsComponentFinished());

}


	#endif

	//**************      FUNCIONES DE TRATAMIENTO DE SE�ALES   *****************

/*
int SGI_ut::EDROOM_Union3_1( int SenalOut){

	int SenalIn;

	switch(SenalOut){

		case( CASGI::STxBurst):	 SenalIn=CAEmuGS::STxBurst; break;

		case( CASGI::STxDataBurst):	 SenalIn=CAEmuGS::STxDataBurst; break;

		default: SenalIn=-1; break;

	}


	return SenalIn;

}


int SGI_ut::EDROOM_Union3_2( int SenalOut){

	int SenalIn;

	switch(SenalOut){

		case( CAEmuGS::SNoAnswer):	 SenalIn=CASGI::SNoAnswer; break;

		case( CAEmuGS::SRxBurst):	 SenalIn=CASGI::SRxBurst; break;

		case( CAEmuGS::SRxDataBurst):	 SenalIn=CASGI::SRxDataBurst; break;

		case( CAEmuGS::SAnswer):	 SenalIn=CASGI::SAnswer; break;

		default: SenalIn=-1; break;

	}


	return SenalIn;

}


int SGI_ut::EDROOM_Union2_1( int SenalOut){

	int SenalIn;

	switch(SenalOut){

		case( CASGI::SInStandBy):	 SenalIn=CAEmuPlanner::SInStandBy; break;

		case( CASGI::STMTransmited):	 SenalIn=CAEmuPlanner::STMTransmited; break;

		case( CASGI::SCommConfigured):	 SenalIn=CAEmuPlanner::SCommConfigured; break;

		case( CASGI::STCReceived):	 SenalIn=CAEmuPlanner::STCReceived; break;

		case( CASGI::SCommInterrupted):	 SenalIn=CAEmuPlanner::SCommInterrupted; break;

		default: SenalIn=-1; break;

	}


	return SenalIn;

}


int SGI_ut::EDROOM_Union2_2( int SenalOut){

	int SenalIn;

	switch(SenalOut){

		case( CAEmuPlanner::SKeepOnComm):	 SenalIn=CASGI::SKeepOnComm; break;

		case( CAEmuPlanner::SToStandBy):	 SenalIn=CASGI::SToStandBy; break;

		case( CAEmuPlanner::STMToTransmit):	 SenalIn=CASGI::STMToTransmit; break;

		case( CAEmuPlanner::SToComm):	 SenalIn=CASGI::SToComm; break;

		default: SenalIn=-1; break;

	}


	return SenalIn;

}


int SGI_ut::EDROOM_Union_1( int SenalOut){

	int SenalIn;

	switch(SenalOut){

		case( CAUTEmuTMTCServer::EmuGSDoublePackList):	 SenalIn=CASGI::EmuGSDoublePackList; break;

		case( CAUTEmuTMTCServer::STMTCPackList):	 SenalIn=CASGI::STMTCPackList; break;

		default: SenalIn=-1; break;

	}


	return SenalIn;

}


int SGI_ut::EDROOM_Union_2( int SenalOut){

	int SenalIn;

	switch(SenalOut){

		case( CASGI::STMDoublePackList):	 SenalIn=CAUTEmuTMTCServer::STMDoublePackList; break;

		case( CASGI::SFinalTCPackets):	 SenalIn=CAUTEmuTMTCServer::SFinalTCPackets; break;

		case( CASGI::STCPackList):	 SenalIn=CAUTEmuTMTCServer::STCPackList; break;

		default: SenalIn=-1; break;

	}


	return SenalIn;

}


int SGI_ut::EDROOM_Union4_1( int SenalOut){

	int SenalIn;

	switch(SenalOut){

		case( CAUTEmuTMTCServer::EmuGSDoublePackList):	 SenalIn=CAEmuGS::EmuGSDoublePackList; break;

		case( CAUTEmuTMTCServer::STMTCPackList):	 SenalIn=CAEmuGS::STMTCPackList; break;

		default: SenalIn=-1; break;

	}


	return SenalIn;

}


int SGI_ut::EDROOM_Union4_2( int SenalOut){

	int SenalIn;

	switch(SenalOut){

		case( CAEmuGS::STMDoublePackList):	 SenalIn=CAUTEmuTMTCServer::STMDoublePackList; break;

		case( CAEmuGS::SFinalTCPackets):	 SenalIn=CAUTEmuTMTCServer::SFinalTCPackets; break;

		case( CAEmuGS::STCPackList):	 SenalIn=CAUTEmuTMTCServer::STCPackList; break;

		default: SenalIn=-1; break;

	}


	return SenalIn;

}

*/
	// ***************	EDROOM Memory ******************************

void SGI_ut::CEDROOMMemory::SetMemory(TEDROOMUInt32 numMessages_, CEDROOMMessage * MessagesMem_, TEDROOMBool * MessagesMemMarks_, CEDROOMQueue::CQueueNode * QueueNodesMem_, TEDROOMBool * QueueNodesMemMarks_){
		CEDROOMComponentMemory::SetMemory( numMessages_,MessagesMem_, MessagesMemMarks_, QueueNodesMem_, QueueNodesMemMarks_, QueueHeads);

	/*EmuPlannerMemory.SetMemory(10,EmuPlannerMessages, &	EmuPlannerMessagesMarks[0],EmuPlannerQueueNodes,&EmuPlannerQueueNodesMarks[0]);

	EmuGSMemory.SetMemory(10,EmuGSMessages, &	EmuGSMessagesMarks[0],EmuGSQueueNodes,&EmuGSQueueNodesMarks[0]);

	TMTCServerMemory.SetMemory(10,TMTCServerMessages, &	TMTCServerMessagesMarks[0],TMTCServerQueueNodes,&TMTCServerQueueNodesMarks[0]);

	SgiMemory.SetMemory(10,SgiMessages, &	SgiMessagesMarks[0],SgiQueueNodes,&SgiQueueNodesMarks[0]);
*/

}

